<template>
	<view class="mainbgc">
		<header-top :messageInfo="{typeFlag:false,message:'消息列表'}"></header-top>
		<!-- <view class="flexcenter" v-if="!newdate.length">
			<view class="placeholderimg"></view>
		</view> -->
		<view class="allnews">
			<view class="itemnews flexleft ffffff mainpadding margin_top"
				@click="jumpurl(1)">
				<view class="flexcenter leftimage">
					<u-icon name="chat" color="#3476fe" size="28"></u-icon>
				</view>
				<view class="right-content flexbetween">
					<view class="flexleft">
						<view class="bottext" style="margin-right: 200rpx;">政策发文</view>
						<view class="num" v-if="info.zcfw_noread_num">{{info.zcfw_noread_num}}</view>
					</view>
					<u-icon name="arrow-right" size="28"></u-icon>
				</view>
			</view>
			<view class="itemnews flexleft ffffff mainpadding margin_top"
				@click="jumpurl(2)">
				<view class="flexcenter leftimage">
					<u-icon name="file-text" color="#3476fe" size="28"></u-icon>
				</view>
				<view class="right-content flexbetween">
					<view class="flexleft">
						<view class="bottext" style="margin-right: 200rpx;">公司制度</view>
						<view class="num" v-if="info.gszd_noread_num">{{info.gszd_noread_num}}</view>
					</view>
					<u-icon name="arrow-right" size="28"></u-icon>
				</view>
			</view>
			<view class="itemnews flexleft ffffff mainpadding margin_top"
				@click="jumpurl(3)">
				<view class="flexcenter leftimage">
					<u-icon name="bell" color="#3476fe" size="28"></u-icon>
				</view>
				<view class="right-content flexbetween">
					<view class="flexleft">
						<view class="bottext" style="margin-right: 200rpx;">最新通知</view>
						<view class="num" v-if="info.zxtz_noread_num">{{info.zxtz_noread_num}}</view>
					</view>
					<u-icon name="arrow-right" size="28"></u-icon>
				</view>
			</view>
			<view class="itemnews flexleft ffffff mainpadding margin_top"
				@click="jumpurl(4)">
				<view class="flexcenter leftimage">
					<u-icon name="question" color="#3476fe" size="28"></u-icon>
				</view>
				<view class="right-content flexbetween">
					<view class="flexleft">
						<view class="bottext" style="margin-right: 200rpx;">常见问题</view>
						<!-- <view class="num" v-if="info.zxtz_noread_num">{{info.zxtz_noread_num}}</view> -->
					</view>
					<u-icon name="arrow-right" size="28"></u-icon>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				info:{}
			}
		},
		onLoad() {
		},
		onShow() {
			this.getInfo()
		},
		methods: {
			getInfo(){ //消息未读数量
				console.log()
				let _this = this;
				httpRequest.request('/employeesapi/index/newsNoReadNum', 'GET', {
					
				}, false, false, true).then(res => {
					if (res.code == 1) {
						this.info=res.data
						if(res.data.total_noread_num!=0){
							uni.setTabBarBadge({
								index: 1,
								text: res.data.total_noread_num
							})
						}else{
							uni.removeTabBarBadge({
								index:1
							})
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			jumpurl(type){
				uni.navigateTo({
					url:"/pages/xiaoxilb/xiaoxilb?type=" + type
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.leftimage {
		width: 106rpx;
		height: 106rpx;
		border-radius: 50%;
		margin-right: 30rpx;
		background-color: #F6F6F6;
		flex: 1.5;
	}

	.imagekf {
		width: 61rpx;
		height: 59rpx;
	}

	.right-content {
		width: 100%;
		flex: 8;
		box-sizing: border-box;
	}

	.toptext {
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #333333;
	}
	.bottext {
		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #000000;
		// width: 300rpx;
		// overflow: hidden;
		// text-overflow: ellipsis;
		// white-space: nowrap;
	}
	.num{
		width: 40rpx;
		height: 40rpx;
		line-height: 40rpx;
		text-align: center;
		background-color: red;
		border-radius: 50%;
		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #ffffff;
	}
	.dian{
		width: 15rpx;
		height: 15rpx;
		background-color: #ff0000;
		border-radius: 50%;
	}
</style>
